package com.hlmedicals.app.system.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *  医生和病人不要直接用id做key缓存，因为两个可能与HisBaseUser的id冲突
 *  可以另建key缓存
 *  @author  sszvip
 */
@Entity
@Table(name = "his_doctor")
@PrimaryKeyJoinColumn(name = "id")
@Inheritance(strategy = InheritanceType.JOINED)
public class HisDoctor extends HisBaseUser implements java.io.Serializable {
	private static final long serialVersionUID = 1L;
	@Column(name = "oldid", nullable = true,unique=true,updatable=false,insertable=false)
    
	private Long oldid; //这个以前的id是为了兼容的第三方软件设置的，不是真正的主键
	private HisDepart currentDepart;// 当前部门
	
	private String signatureFile;// 签名文件
	/** 办公电话 */ 
	private String officePhone;// 办公电话
	/** 邮箱 */ 
	private String email;// 邮箱
	/** "1:医生"、"2:主治医生"、 "3:副主任医生"、"4:主任医生"、其它   */
	private String doctorClass;
	/** 性别 */
	private String sex;
	/** 出生日期 */
	private String birth ;
	/** 婚否 */
	private String marry;
	/** 籍贯 */
	private String nativePlace;
	/** 现居地址 */
	private String address;
	/** 医生身份证号 */
	private String idcard;
	/** 医龄 */
	private String doctorYear;
	/** 登陆mac */
	private String macAddr;
	/**创建时间*/
	private java.util.Date createDate;
	/**创建人ID*/
	private java.lang.String createBy;
	/**创建人名称*/
	private java.lang.String createName;
	/**修改时间*/
	private java.util.Date updateDate;
	/**修改人*/
	private java.lang.String updateBy;
	/**修改人名称*/
	private java.lang.String updateName;
	
	@Transient
	private String roleCodes;
	@Transient
	private String deptName;
	@Transient
	private Integer patientcount;
	private String parentDoctorId;
	@Transient
	private String parentDoctorRealName;
	
	public HisDoctor(){}
	
	
	@Column(name = "parent_doctor_id", nullable = true, length = 32) 
	public String getParentDoctorId() {
		return parentDoctorId;
	}
	
	@Column(name = "mac_addr", nullable = true, length = 32)
	public String getMacAddr() {
		return macAddr;
	}
	@javax.persistence.Transient
	public String getDeptName() {
		return deptName;
	}

	public void setDeptName(String deptName) {
		this.deptName = deptName;
	}

	@javax.persistence.Transient
	public String getRoleCodes() {
		return roleCodes;
	}

	public void setRoleCodes(String roleCodes) {
		this.roleCodes = roleCodes;
	}
	public void setMacAddr(String macAddr) {
		this.macAddr = macAddr;
	}

	
	public Long getOldid() {
		return oldid;
	}
	
	public void setOldid(Long oldid) {
		this.oldid = oldid;
	}
	
	@Column(name = "doctor_class", nullable = true, length = 2)
	public String getDoctorClass() {
		return doctorClass;
	}

	public void setDoctorClass(String doctorClass) {
		this.doctorClass = doctorClass;
	}
	@Column(name = "sex", nullable = true, length = 2)
	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}
	@Column(name = "birth", nullable = true, length = 10)
	public String getBirth() {
		return birth;
	}

	public void setBirth(String birth) {
		this.birth = birth;
	}
	@Column(name = "marry", nullable = true, length = 1)
	public String getMarry() {
		return marry;
	}

	public void setMarry(String marry) {
		this.marry = marry;
	}
	@Column(name = "native_place", nullable = true, length = 128)
	public String getNativePlace() {
		return nativePlace;
	}

	public void setNativePlace(String nativePlace) {
		this.nativePlace = nativePlace;
	}
	@Column(name = "address", nullable = true, length = 128)
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getIdcard() {
		return idcard;
	}

	public void setIdcard(String idcard) {
		this.idcard = idcard;
	}
	@Column(name = "doctor_year", nullable = true, length = 18)
	public String getDoctorYear() {
		return doctorYear;
	}

	public void setDoctorYear(String doctorYear) {
		this.doctorYear = doctorYear;
	}

	@Column(name = "signature_file", length = 100)
	public String getSignatureFile() {
		return this.signatureFile;
	}

	public void setSignatureFile(String signatureFile) {
		this.signatureFile = signatureFile;
	}
	
	@Column(name = "office_phone", length = 20)
	public String getOfficePhone() {
		return this.officePhone;
	}

	public void setOfficePhone(String officePhone) {
		this.officePhone = officePhone;
	}

	@Column(name = "email", length = 50)
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}
	/**
	 *方法: 取得java.util.Date
	 *@return: java.util.Date  创建时间
	 */
	@Column(name ="create_date",nullable=true)
	public java.util.Date getCreateDate(){
		return this.createDate;
	}

	/**
	 *方法: 设置java.util.Date
	 *@param: java.util.Date  创建时间
	 */
	public void setCreateDate(java.util.Date createDate){
		this.createDate = createDate;
	}
	/**
	 *方法: 取得java.lang.String
	 *@return: java.lang.String  创建人ID
	 */
	@Column(name ="create_by",nullable=true,length=32)
	public java.lang.String getCreateBy(){
		return this.createBy;
	}

	/**
	 *方法: 设置java.lang.String
	 *@param: java.lang.String  创建人ID
	 */
	public void setCreateBy(java.lang.String createBy){
		this.createBy = createBy;
	}

	/**
	 *方法: 取得java.lang.String
	 *@return: java.lang.String  创建人名称
	 */
	@Column(name ="create_name",nullable=true,length=32)
	public java.lang.String getCreateName(){
		return this.createName;
	}
	
	/**
	 *方法: 设置java.lang.String
	 *@param: java.lang.String  创建人名称
	 */
	public void setCreateName(java.lang.String createName){
		this.createName = createName;
	}
	
	/**
	 *方法: 取得java.util.Date
	 *@return: java.util.Date  修改时间
	 */
	@Column(name ="update_date",nullable=true)
	public java.util.Date getUpdateDate(){
		return this.updateDate;
	}

	/**
	 *方法: 设置java.util.Date
	 *@param: java.util.Date  修改时间
	 */
	public void setUpdateDate(java.util.Date updateDate){
		this.updateDate = updateDate;
	}
	/**
	 *方法: 取得java.lang.String
	 *@return: java.lang.String  修改人ID
	 */
	@Column(name ="update_by",nullable=true,length=32)
	public java.lang.String getUpdateBy(){
		return this.updateBy;
	}

	/**
	 *方法: 设置java.lang.String
	 *@param: java.lang.String  修改人ID
	 */
	public void setUpdateBy(java.lang.String updateBy){
		this.updateBy = updateBy;
	}
	/**
	 *方法: 取得java.lang.String
	 *@return: java.lang.String  修改人名称
	 */
	@Column(name ="update_name",nullable=true,length=32)
	public java.lang.String getUpdateName(){
		return this.updateName;
	}

	/**
	 *方法: 设置java.lang.String
	 *@param: java.lang.String  修改人名称
	 */
	public void setUpdateName(java.lang.String updateName){
		this.updateName = updateName;
	}

  @ManyToOne(fetch = FetchType.EAGER)
  @JoinColumn(name = "dept_id")
  public HisDepart getCurrentDepart() {
      return currentDepart;
  }

  public void setCurrentDepart(HisDepart currentDepart) {
      this.currentDepart = currentDepart;
  }

//  @JsonIgnore
//  @OneToMany(mappedBy = "hisDoctor")
//  public List<HisDoctorOrg> getUserOrgList() {
//      return userOrgList;
//  }
//
//  public void setUserOrgList(List<HisDoctorOrg> userOrgList) {
//      this.userOrgList = userOrgList;
//  }
/**
 * 方法：取得 long
 * 
 * @return: long patientcount
 */
 @Transient
public Integer getPatientcount() {
	return patientcount;
}
  
/**
 * 方法：设置long
 * 
 * @param: long patientcount
 */
public void setPatientcount(Integer patientcount) {
	this.patientcount = patientcount;
}

/**
 * 方法：设置String
 * 
 * @param: String parentDoctorId
 */
public void setParentDoctorId(String parentDoctorId) {
	this.parentDoctorId = parentDoctorId;
}

/**
 * 方法：取得 String
 * 
 * @return: String parentDoctorRealName
 */
@Transient
public String getParentDoctorRealName() {
	return parentDoctorRealName;
}
/**
 * 方法：设置String
 * 
 * @param: String parentDoctorRealName
 */
public void setParentDoctorRealName(String parentDoctorRealName) {
	this.parentDoctorRealName = parentDoctorRealName;
}

//	@JsonIgnore    //getList查询转换为列表时处理json转换异常
//	@ManyToOne(fetch = FetchType.LAZY)
//	@JoinColumn(name = "departid")
//	public HisDepart getHisDepart() {
//		return this.HisDepart;
//	}
//
//	public void setHisDepart(HisDepart HisDepart) {
//		this.HisDepart = HisDepart;
//	}
}